#版本 注意，需要跟随版本号进行调整
version=1.0.2
#运行目录
run_path=/root/s2b2b2c/service

ps -ef | grep java | grep gateway | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep system-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep goods-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep user-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep order-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep payment-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep promotion-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep statistics-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep distribution-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep broadcast-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep auth-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep resource-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep supplier-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep im-service | grep -v 'grep' | awk '{print $2}' | xargs kill -9
ps -ef | grep java | grep consumer | grep -v 'grep' | awk '{print $2}' | xargs kill -9

nohup java -Xmx512m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/gateway-$version.jar >${run_path}/logs/gateway.out &
nohup java -Xmx512m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/system-service-$version.jar >${run_path}/logs/system-service.out &
nohup java -Xmx512m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/goods-service-$version.jar >${run_path}/logs/goods-service.out &
nohup java -Xmx512m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/user-service-$version.jar >${run_path}/logs/user-service.out &
nohup java -Xmx512m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/order-service-$version.jar >${run_path}/logs/order-service.out &
nohup java -Xmx256m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/payment-service-$version.jar >${run_path}/logs/payment-service.out &
nohup java -Xmx256m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/promotion-service-$version.jar >${run_path}/logs/promotion-service.out &
nohup java -Xmx256m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/statistics-service-$version.jar >${run_path}/logs/statistics-service.out &
nohup java -Xmx256m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/distribution-service-$version.jar >${run_path}/logs/distribution-service.out &
nohup java -Xmx256m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/broadcast-service-$version.jar >${run_path}/logs/broadcast-service.out &
nohup java -Xmx256m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/auth-service-$version.jar >${run_path}/logs/auth-service.out &
nohup java -Xmx256m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/resource-service-$version.jar >${run_path}/logs/resource-service.out &
nohup java -Xmx256m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/supplier-service-$version.jar >${run_path}/logs/supplier-service.out &
nohup java -Xmx256m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/im-service-$version.jar >${run_path}/logs/im-service.out &
nohup java -Xmx512m -Xms128m -Xss256k -jar --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED ${run_path}/consumer-$version.jar >${run_path}/logs/consumer.out &
echo "服务启动成功"
